package com.ddtech.business.course.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ddtech.business.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 章节表
 * </p>
 *
 * @author bin_pu
 * @since 2023-02-06
 */
@Data
@ApiModel(value = "Chapter对象", description = "章节表")
public class CourseChapter extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "章节名称")
    @TableField("chapter_name")
    private String label;

    @ApiModelProperty(value = "课程id")
    private String courseId;

    @ApiModelProperty(value = "章节父id")
    private String pid;

    @ApiModelProperty(value = "排序号")
    private Integer sort;

    /**
     * 资源列表
     */
    @TableField(exist = false)
    private List<CourseResource> courseResourceList;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CourseChapter courseChapter = (CourseChapter) o;
        return Objects.equals(super.getId(), courseChapter.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.getId());
    }
}
